<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
</body>
<script>
    function Animal() {
        this.species = "animal";
    }

    function Cat(name, color) {
        this.name = name;
        this.color = color;
    }

    //将Cat的prototype对象指向一个Animal的实例
    Cat.prototype = new Animal();
    //将Cat的constructor指回Cat本身，不然则会指向Animal
    Cat.prototype.constructor = Cat;

    var cat1 = new Cat("a", "red");
    console.log(cat1.name + " " + cat1.color);
    console.log(cat1 instanceof Cat);
    console.log(cat1.species);
</script>
</html>